package svc

import (
	"github.com/zeromicro/go-zero/core/stores/sqlx"
	"gozerogateway/rpc/model/appmodel"
	"gozerogateway/rpc/tenant/internal/config"
)

type ServiceContext struct {
	Config config.Config

	AppModel appmodel.GatewayAppModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	sqlConn := sqlx.NewMysql(c.Mysql.Datasource)
	return &ServiceContext{
		Config: c,

		AppModel: appmodel.NewGatewayAppModel(sqlConn),
	}
}
